<div class="sc_body">
    <div class="sc_title sc_body_title">
        <h5>{$nodeInfo.title}</h5>
        <div class="sc_title_btn">
            {eq name="nodeInfo.children" value="0"}
                <button class='layui-btn layui-btn-sm' data-url="{:U('insert')}?spm={$spm}"><i class="layui-icon">&#xe654;</i> 新增</button>
            {/eq}
        </div>
    </div>
    <div class="sc_search layui-clear">
        <form method="get" action="__SELF__" class="layui-form sc_search_form">
            <div class="layui-input-inline">
                <input type="text" name="keyword" placeholder="请输入标题名称" value="{$keyword|default=''}" class="layui-input">
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="start_time" placeholder="起始时间" value="{$start_time|default=''}" class="layui-input sc_form_date" readonly="">
                </div>
                -
                <div class="layui-input-inline">
                    <input type="text" name="end_time" placeholder="结束时间" value="{$end_time|default=''}" class="layui-input sc_form_date" readonly="">
                </div>
            </div>
            <button class="layui-btn layui-btn-danger sc_btn_search">搜索</button>
        </form>
    </div>
    <div class="fadeInUp animated">
        <form id="form-list" class="layui-form">
            <input type="hidden" name="nid" value="{$nid}" />
            <div class="sc_mobile">
                <div class="layui-input-inline">
                    <select name="news_nid" lay-filter="category">
                        <option value="0">若无需求，可不选！</option>
                        {volist name="category" id="data"}
                            <option value="{$data.id}" {if condition="$nodeInfo['id'] == $data['id'] || $nodeInfo['tid'] !== $data['tid'] || $data['children'] == 1"}disabled{/if}>{$data.delimiter}{$data['pid']?'├':''} {$data.title}</option>
                        {/volist}
                    </select>
                </div>
                <button class="layui-btn layui-btn-disabled btn-mobile" data-action="{:U('mobile')}?spm=m-1-{$nodeInfo.id}" disabled="">确定</button>
                <button class='layui-btn layui-btn-danger' data-action="{:U('delete')}?spm={$spm}">删除选中</button>
            </div>
            <table class="layui-table" lay-even lay-skin="nob">
                <colgroup>
                    <col width="50">
                    <col>
                    <col width="160">
                    <col width="150">
                </colgroup>
                <thead>
                    <tr>
                        <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose" class="list-check-box"></th>
                        <th>标题</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {volist name="list" id="data"}
                    <tr>
                        <td><input type="checkbox" name="id[]" value="{$data.id}" lay-skin="primary" class="list-check-box"></td>
                        <td class="layui-elip"><a data-url="{:U('update')}?id={$data.id}&spm={$spm}" data-title="编辑">{$data.title}</a></td>
                        <td>{$data.create_time}</th>
                        <td>
                            <a data-url="{:U('update')}?id={$data.id}&spm={$spm}" data-title="编辑">编辑</a>
                            <span class="sc_explode">|</span>
                            <a data-confirm="{:U('delete')}?id={$data.id}&spm={$spm}">删除</a>
                        </td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
        </form>
        <div class="layui-clear">
            <div class="fr">
                <div class="sc_pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
<script>
    lay('.sc_form_date').each(function(){
        layui.laydate.render({
            elem: this
            ,trigger: 'click'
            ,type: 'datetime'
        });
    });
    layui.form.on('checkbox(allChoose)', function(data){
        var child = $(data.elem).parents('table').find('input[type="checkbox"]');
        child.each(function(index, item){
            item.checked = data.elem.checked;
        });
        if ($('.layui-table').find('.list-check-box').is(':checked')) {
            $('.sc_search').hide(300,function(){$('.sc_mobile').show(300);});
        } else {
            $('.sc_mobile').hide(300,function(){$('.sc_search').show(300);});
        };
        layui.form.render('checkbox');
    });
    $('.sc_mobile').hide();
    layui.form.on('checkbox', function(data){
        if ($('.layui-table').find('.list-check-box').is(':checked')) {
            $('.sc_search').hide(300,function(){$('.sc_mobile').show(300);});
        } else {
            $('.sc_mobile').hide(300,function(){$('.sc_search').show(300);});
        };
    });
</script>
